/*
day59_2
2019.10.26
*/
#include<math.h>
struct TreeNode {
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
};

int help(struct TreeNode *root,int sum[])
{
	if(!root) return 0;
	
	int l = help(root->left,sum);
	int r = help(root->right,sum);
	
	int ab = abs(l-r);
	sum[0] += ab;
	
	return l + r + root->val;
}

int findTilt(struct TreeNode* root){
	int sum[] = {0};
	help(root,sum);
	return sum[0];
}


int main()
{
	return 0;
}
